//
// Created by root on 16-9-13.
//

#include "stdio.h"
#include "string.h"

char *
my_strstr(char const *s1, char const *s2)
{
    register char *last;
    register char *current;

    last = NULL;

    if(*s2 != '\0')
    {
        current = strstr(s1, s2);
        while (current != NULL)
        {
            last = current;
            current = strstr(last + 1, s2);
        }
    }

    return last;
}

void main()
{
    char string[20] = "Hello there,honey.";
    char *ans;

    ans = strchr(string, 'h');
    if(ans)
        printf("--%s--\n", ans);
    else
        printf("not found\n");

    char *ans2;

    ans2 = strpbrk(string, "txy");
    if(ans2)
        printf("--%s--\n", ans2);
    else
        printf("not found pbrk\n");
}